//
//  HttpEngine.h
//  DemoHttpEngine
//
//  Created by zeng on 12-4-5.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

#define KCOOKIENAME @"KCOOKIENAME"
#define KCOOKIEVALUE @"KCOOKIEVALUE"
#define KCOOKIEDOMAIN @"KCOOKIEDOMAIN"
#define KCOOKIEPATH @"KCOOKIEPATH"

@protocol HttpGetDataDelegate;

/*
 -1.网络错误
 -2.数据错误
 -3往后.具体错误
 */

//@class AFHTTPClient;
//@class ASIHTTPRequest;


@interface HttpBase : NSObject {
//    AFHTTPClient *httpClient;
//    ASIHTTPRequest *request;
    
	NSString *url;
	NSString *postXml; 
	NSData *postData;
	int medthod;

	int resultCode;
	NSString *errorMsg;
    NSMutableDictionary *headers;
}
@property NSString *url;
@property NSString *postXml;
@property NSData *postData;
@property int resultCode;
@property NSString *errorMsg;
@property(assign,nonatomic) id<HttpGetDataDelegate>delegate;
@property NSDictionary *responseHeaders;
@property NSUInteger timeOut;


-(void)startAFAsynHttpFormData:(NSDictionary *)postDic;

-(void)startAFAsynHttpFormData:(NSDictionary *)postDic
                      Username:(NSString *)username
                        Passwd:(NSString *)passwd;



/*
 取消异步请求
 同步请求不能取消
 */
-(void)stopAsynHttp;

-(void)endCode:(NSInteger)code Err:(NSString *)err;
-(void)handleResult:(id)result;
-(void)addHeader:(NSString *)headerKey Value:(NSString *)value;
@end

@protocol HttpGetDataDelegate <NSObject>
-(void)getdataDidFinished:(HttpBase *)getdata;
-(void)getdataDidFailed:(HttpBase *)getdata;
@end
